<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <link rel="stylesheet" href="css/font-awesome.css" />
    <link rel="stylesheet" href="css/register.css" />
    <script src="js/jquery-1.12.4.min.js"></script>
    <script src="js/bootstrap.min.js"></script>

</head>
<body>
<nav class="navbar navbar-default navbar-inverse navbar-static-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" style="color: #ffffff;"><i class="fa fa-sign-language"></i>阳光小区</a>
        </div>
    </div>
</nav>
<div class="container">
    <div class="row">
        <div class="col-xs-6 col-xs-push-3 register-panel">
            <ul class="nav nav-pills">
                <li class="active"><a href="#usernameRegister" data-toggle="tab">用户名密码注册</a></li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane active" >
                    <form onsubmit="javascript: return false;">
                        <div class="form-group">
                            <label for="username">用户名: </label>
                            <input type="text" autocomplete="off" class="form-control" id="username">
                        </div>
                        <div class="form-group">
                            <label for="password">密码</label>
                            <input type="password" id="password" class="form-control">
                        </div>
                        <div class="form-group">
                            <label for="phone">手机号</label>
                            <input type="text" id="phone" class="form-control">
                        </div>
                        <div class="form-group">
                            <label for="email">邮箱</label>
                            <input type="text"  id="email" class="form-control">
                        </div>
                        <div class="form-group">
                            <input onclick="userRegister()" type="button" value="注册"  class="btn btn-block btn-primary" />
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
   //在这里获取用户输入的各种参数
    function userRegister() {
        let params ={
            username:$("#username").val(),
            password:$("#password").val(),
            phone:$("#phone").val(),
            email:$("#email").val()
        }
        let paramsJSON=JSON.stringify(params)
        $.ajax({
            type:"POST",
            url:"http://localhost:8080/tUser/register",
            contentType: "application/json; charset=utf-8",
            data:paramsJSON,
            success:function (resp) {
                console.log(resp)
                //location.href="login.html"
            }

    })
}
</script>
</html>